<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>个人信息 - HRMS</title>
    <jsp:include page="../include/head.jsp"/>
</head>
<body>
<jsp:include page="../include/header.jsp"/>

<div class="container mt-4">
    <div class="row mb-3">
        <div class="col">
            <a href="${pageContext.request.contextPath}/auth/index" class="btn btn-secondary">
                <i class="fas fa-arrow-left"></i> 返回首页
            </a>
        </div>
    </div>

    <div class="row">
        <div class="col-md-3">
            <!-- 侧边栏 -->
            <div class="card">
                <div class="card-body">
                    <div class="d-flex flex-column align-items-center text-center">
                        <div class="mt-3">
                            <h4>${loginUser.empName}</h4>
                            <p class="text-muted mb-1">${loginUser.getRoleName()}</p>
                            <p class="text-muted mb-1">
                                    <span class="badge ${loginUser.isActive() ? 'bg-success' : 'bg-danger'}">
                                        ${loginUser.isActive() ? '在职' : '离职'}
                                    </span>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-9">
            <!-- 个人信息卡片 -->
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">基本信息</h5>
                    <hr>
                    <div class="row">
                        <div class="col-md-6">
                            <p><strong>员工ID：</strong>${loginUser.empId}</p>
                            <p><strong>姓名：</strong>${loginUser.empName}</p>
                            <p><strong>性别：</strong>${loginUser.getGenderDesc()}</p>
                            <p><strong>出生日期：</strong>
                                <fmt:formatDate value="${loginUser.empBirthDate}" pattern="yyyy-MM-dd"/>
                            </p>
                            <p><strong>身份证号：</strong>${loginUser.empIdcard}</p>
                        </div>
                        <div class="col-md-6">
                            <p><strong>手机号：</strong>${loginUser.empPhone}</p>
                            <p><strong>学历：</strong>${loginUser.empEducation}</p>
                            <p><strong>角色：</strong>${loginUser.getRoleName()}</p>
                            <p><strong>部门ID：</strong>${loginUser.orgId}</p>
                            <p><strong>薪酬标准ID：</strong>${loginUser.salaryStandardId}</p>
                        </div>
                    </div>

                    <h5 class="card-title mt-4">工作信息</h5>
                    <hr>
                    <div class="row">
                        <div class="col-md-6">
                            <p><strong>入职日期：</strong>
                                <fmt:formatDate value="${loginUser.empEntryDate}" pattern="yyyy-MM-dd"/>
                            </p>
                            <p><strong>状态：</strong>
                                <span class="badge ${loginUser.isActive() ? 'bg-success' : 'bg-danger'}">
                                    ${loginUser.isActive() ? '在职' : '离职'}
                                </span>
                            </p>
                        </div>
                        <div class="col-md-6">
                            <p><strong>创建时间：</strong>
                                <fmt:formatDate value="${loginUser.empCreateTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                            </p>
                            <p><strong>最后更新：</strong>
                                <fmt:formatDate value="${loginUser.empUpdateTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
